<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>角色人员管理</title>
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/easyui/themes/default/easyui.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/easyui/themes/icon.css" />
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/cms.css" />

	<script type="text/javascript" src="<%=request.getContextPath() %>/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/easyui/locale/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/win.js"></script>
	<script type="text/javascript">
		function addRoleUser(){
			openUrl("新增角色人员", 600, 500, "<%=request.getContextPath() %>/user/selectUser.do");
		}
		
		function reloadDg(){
			$("#dg").datagrid("reload");
			closeWin();
		}
		
		function deleteRoleUser(){
			checkSelectSomeDoAction("#dg", "删除", "角色人员", "<%=request.getContextPath() %>/role/removeRoleUser.do?roleId=${roleVO.id}", true);
		}
		
		function selectUsers(ids){
			$.ajax({
			   type: "POST",
			   url: "<%=request.getContextPath() %>/role/addRoleUser.do",
			   dataType: "text",
			   data:{ids:ids, roleId:'${roleVO.id}'},
			   success: function(result){
				   if (result == "success") {
					   reloadDg();
			        } else {
			        	$.messager.alert("提示", alertPrefix + result, 'info');
			        }
			   }
			});
		}
		
	</script>
	<style type="text/css">
		#roleInfo{
			border-collapse: collapse;
			margin-bottom: 10px;
		}
		#roleInfo td{
			padding: 5px 10px;
		}
	</style>
</head>
<body>
	<div class="dg-content">
		<table style="width: 100%" id="roleInfo">
			<tr>
				<td width="100px;">角色名称:${roleVO.name}</td>
			</tr>
			<tr>
				<td>角色描述:${roleVO.remark}</td>
			</tr>
		</table>
	
		<table id="dg" class="easyui-datagrid" title="角色人员列表"
			data-options="rownumbers:true,pagination:true,
				fitColumns:true,iconCls:'icon-users',toolbar:'#toolbar',
				url:'<%=request.getContextPath() %>/role/listRoleUsers.do?roleId=${roleVO.id}'">
			<thead>
				<tr>
					<th data-options="field:'ck',checkbox:true"></th>
					<th data-options="field:'id',hidden:true"></th>
					<th data-options="field:'nickname',width:100,align:'center'">姓名</th>
					<th data-options="field:'username',width:150,align:'center'">用户名</th>
				</tr>
			</thead>
		</table>
		<div class='dg-toolbar' id="toolbar" style="padding:5px 10px;">
			<a href="javascript:addRoleUser()" class="easyui-linkbutton" iconCls="icon-add" plain="true">新增</a>
			<a href="javascript:deleteRoleUser()" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a>
			<a href="manager.do" class="easyui-linkbutton" iconCls="icon-back" plain="true">返回</a>
		</div>
	</div>
	
</body>
</html>